<?php

use Dingo\Api\Routing\Router;

/** @var Router $api */
$api = app(Router::class);

$api->version('v1', function (Router $api) {
    $api->group(['namespace' => 'App\Api\V1\Controllers'], function (Router $api) {
        // 接收微信授权事件
        $api->any('/open/notify_auth', 'WechatController@notifyAuth');
        $api->any('/open/notify_msg/{appId}', 'WechatController@notifyMsg');
        $api->get('/open/wechat/open-platform/get-token', 'WechatController@getToken');
        
        $api->get('/open/wechat/authorization-callback', 'WechatController@authorizationCallback');
    });
    
    /**
     * 登录模块
     */
    $api->group(['prefix' => 'auth'], function (Router $api) {
        $api->post('login', 'App\\Api\\V1\\Controllers\\Boilerplate\\LoginController@login');
        $api->post('signup', 'App\\Api\\V1\\Controllers\\Boilerplate\\SignUpController@signUp');
        $api->post('recovery', 'App\\Api\\V1\\Controllers\\Boilerplate\\ForgotPasswordController@sendResetEmail');
        $api->post('reset', 'App\\Api\\V1\\Controllers\\Boilerplate\\ResetPasswordController@resetPassword');
        $api->group(['middleware' => 'jwt.auth'], function (Router $api) {
            $api->get('me', 'App\\Api\\V1\\Controllers\\Boilerplate\\UserController@me');
            $api->post('logout', 'App\\Api\\V1\\Controllers\\Boilerplate\\LogoutController@logout');
        });
        $api->group(['middleware' => 'jwt.refresh'], function (Router $api) {
            $api->post('refresh', 'App\\Api\\V1\\Controllers\\Boilerplate\\RefreshController@refresh');
        });
    });



});
